package com.edushare.common.vo;

import com.edushare.common.vo.auto._GradeKey;

public class GradeKey extends _GradeKey implements Comparable<GradeKey> {

	public static final int ACTIVE_KEY 				=	10;
	public static final int INACTIVE_KEY 			=	20;
	
	public static final int UNIVERSITY_KEY			= 	10;
	public static final int DEPARTMENT_KEY			= 	20;
	public static final int COURSE_KEY				= 	30;
	
	public static final int PASSING_GRADE			= 	10;
	public static final int FAILING_GRADE			= 	20;
	
	public int compareTo(GradeKey o) {
		if (this.getMinimumMarks() - o.getMinimumMarks() < 0)
			return -1;
		if (this.getMinimumMarks() - o.getMinimumMarks() > 0)
			return 1;
		return 0;
	}
	
	@Override
	public void setGradeAlphabet(String s){
		super.setGradeAlphabet(s.trim());
	}
	
	public void setPass(boolean pass){
		setPassGrade(pass?PASSING_GRADE:FAILING_GRADE);
	}
	
	public boolean isPass(){
		if(getPassGrade() == null){
			setPassGrade(PASSING_GRADE);
		}
		if(getPassGrade() == PASSING_GRADE)
			return true;
		return false;
	}
}
